package com.dd.service.Impl;

import com.dd.dao.Impl.UserMySqlDaoImpl;
import com.dd.dao.UserDao;
import com.dd.service.UserService;

import java.util.Date;

public class UserServiceImpl implements UserService {

    UserDao userDao;

    //setter注入
//    public void setUserDao(UserMySqlDaoImpl userDao) {
//        this.userDao = userDao;
//    }

    //构造器注入
    public UserServiceImpl(UserMySqlDaoImpl userMySqlDao,Date birthday,double salary) {
        this.userDao = userMySqlDao;
        this.birthday = birthday;
        this.salary = salary;
    }


    private String name;

    private int age;

    private Date birthday;

    private double salary;



    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }


    public void sayHello() {
        userDao.sayHello();

        System.out.println(name+"的年龄是"+age+"岁");
        System.out.println("生日是"+birthday);
        System.out.println("薪水是"+salary);
    }
}
